package com.gec.service.impl;

import java.util.List;

import com.gec.dao.UserDao;
import com.gec.dao.impl.UserDaoImpl;
import com.gec.domain.User;
import com.gec.service.UserService;

public class UserServiceImpl implements UserService {
	
	//注入userDao 就是service没有dao不行
	UserDao dao = new UserDaoImpl();

	@Override
	public void save(User user) {
		dao.save(user);
	}

	@Override
	public void delete(Integer id) {
		dao.delete(id);
	}

	@Override
	public void update(User user) {
		dao.update(user);
	}

	@Override
	public User getUserById(Integer id) {
		User user = dao.getUserById(id);
		return user;
	}

	@Override
	public List<User> findAllUsers() {
		List<User> users = dao.findAllUsers();
		return users;
	}

	@Override
	public User login(String name, String password) {
		User user = dao.login(name,password);
		return user;
	}

}
